import dark from '@/views/commonView/theme/json/dark.json'
import chalk from '@/views/commonView/theme/json/chalk.json'
import essos from '@/views/commonView/theme/json/essos.json'
import infographic from '@/views/commonView/theme/json/infographic.json'
import macarons from '@/views/commonView/theme/json/macarons.json'
import purplePassion from '@/views/commonView/theme/json/purple-passion.json'
import roma from '@/views/commonView/theme/json/roma.json'
import shine from '@/views/commonView/theme/json/shine.json'
import vintage from '@/views/commonView/theme/json/vintage.json'
import walden from '@/views/commonView/theme/json/walden.json'
import westeros from '@/views/commonView/theme/json/westeros.json'
import wonderland from '@/views/commonView/theme/json/wonderland.json'

function Theme () {
}

let map = new Map()
map.set('dark', dark)
map.set('chalk', chalk)
map.set('essos', essos)
map.set('infographic', infographic)
map.set('macarons', macarons)
map.set('purple-passion', purplePassion)
map.set('roma', roma)
map.set('shine', shine)
map.set('vintage', vintage)
map.set('walden', walden)
map.set('westeros', westeros)
map.set('wonderland', wonderland)

Theme.prototype.themeMap = map

Theme.prototype.getTheme = function (name) {
    let map = this.themeMap
    return map.get(name)
}
Theme.prototype.addTheme = function (name, val) {
    let map = this.themeMap
    if ((typeof name === 'String') && val) {
        map.set(name, val)
        return true
    } else {
        console.error('添加主题失败！')
        console.error('name: ' + name)
        console.error('val: ' + val)
    }
}

let theme = new Theme()
export default{
    theme
}
